﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ThePresenter.ViewModel;

namespace ThePresenter.UserInterface
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window
	{

		/// <summary>
		/// Identifies the <see cref="ViewModel"/> property.
		/// </summary>
		/// <value>The identifier for the <see cref="ViewModel"/> dependency property.</value>
		public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register("ViewModel", typeof(ViewModelBase), typeof(MainWindow), new PropertyMetadata(new PropertyChangedCallback(OnViewModelChanged)));

		/// <summary>
		/// Gets or sets the ViewModel. This is a dependency property.
		/// </summary>
		/// <value>The ViewModel.</value>
		public ViewModelBase ViewModel
		{
			get
			{
				return (ViewModelBase)GetValue(ViewModelProperty);
			}
			set
			{
				SetValue(ViewModelProperty, value);
			}
		}
		
		/// <summary>
		/// Initializes a new instance of the <see cref="MainWindow"/> class.
		/// </summary>
		public MainWindow()
		{
			InitializeComponent();
			// ViewModel = ...
		}

		/// <summary>
		/// Called when ViewModel changed.
		/// </summary>
		/// <param name="d">The <see cref="System.Windows.DependencyObject"/> on which the property has changed value.</param>
		/// <param name="e">Event data that is issued by any event that tracks changes to the effective value of this property.</param>
		private static void OnViewModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			var This = d as MainWindow;

			Debug.Assert(This != null);

			// This.OnSelectedTabChanged(new PropertyChangedEventArgs<MainWindowTab>((MainWindowTab)e.OldValue, (MainWindowTab)e.NewValue));
		}
	}
}
